package com.education.welco.service.impl;


import com.education.common.utils.Convert;
import com.education.welco.mapper.SCatalogPreviewMapper;
import com.education.welco.pojo.SCatalogPreview;
import com.education.welco.service.ISCatalogPreviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程预习 服务层实现
 *
 * @author d
 * @date 2020-05-08
 */
@Service
public class SCatalogPreviewServiceImpl implements ISCatalogPreviewService {

    @Autowired
    private SCatalogPreviewMapper sCatalogPreviewMapper;


    /**
     * 查询课程预习信息
     *
     * @param list 课程预习ID
     * @return 课程预习信息
     */
    @Override
    public List<SCatalogPreview> selectSCatalogPreviewByIds(List<Integer> list) {
        return sCatalogPreviewMapper.selectSCatalogPreviewByIds(list);
    }

    /**
     * 查询课程预习信息
     *
     * @param catalogId 课程预习ID
     * @return 课程预习信息
     */
    @Override
    public List<SCatalogPreview> selectSCatalogPreviewByCatalogId(Integer catalogId) {
        return sCatalogPreviewMapper.selectSCatalogPreviewByCatalogId(catalogId);
    }

    /**
     * 查询课程预习信息
     *
     * @param id 课程预习ID
     * @return 课程预习信息
     */
    @Override
    public SCatalogPreview selectSCatalogPreviewById(Integer id) {
        return sCatalogPreviewMapper.selectSCatalogPreviewById(id);
    }

    /**
     * 查询课程预习列表
     *
     * @param sCatalogPreview 课程预习信息
     * @return 课程预习集合
     */
    @Override
    public List<SCatalogPreview> selectSCatalogPreviewList(SCatalogPreview sCatalogPreview) {
        return sCatalogPreviewMapper.selectSCatalogPreviewList(sCatalogPreview);
    }

    /**
     * 新增课程预习
     *
     * @param sCatalogPreview 课程预习信息
     * @return 结果
     */
    @Override
    public int insertSCatalogPreview(SCatalogPreview sCatalogPreview) {
        return sCatalogPreviewMapper.insertSCatalogPreview(sCatalogPreview);
    }

    @Override
    public int deleteSCatalogPreviewById(Integer id) {
        return sCatalogPreviewMapper.deleteSCatalogPreviewById(id);
    }

    /**
     * 修改课程预习
     *
     * @param sCatalogPreview 课程预习信息
     * @return 结果
     */
    @Override
    public int updateSCatalogPreview(SCatalogPreview sCatalogPreview) {
        return sCatalogPreviewMapper.updateSCatalogPreview(sCatalogPreview);
    }

    /**
     * 删除课程预习对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSCatalogPreviewByIds(String ids) {
        return sCatalogPreviewMapper.deleteSCatalogPreviewByIds(Convert.toStrArray(ids));
    }
}